package com.example.demo.util;

import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

public enum Algorithm {

    /**
     * 第一个：RSA 加密算法     "RSA", "AES", "DES"
     * 第二个：ECB/CBC 加密模式  "ECB", "CBC", "CTR", "CFB", "OFB"
     * 第三个：Padding 当数据的长度不满足条件时的填充模式  "PKCS1Padding", "NoPadding", "PKCS5Padding", "OAEPWithSHA-1AndMGF1Padding"
     */

    // RSA 加密
    RSA("RSA"),
    RSA_ECB_NoPadding("RSA/ECB/NoPadding"),
    RSA_ECB_PKCS1Padding("RSA/ECB/PKCS1Padding"),
    RSA_ECB_OAEPWithSHA_1AndMGF1Padding("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"),

    // AES 加密
    AES_ECB_NoPadding("AES/ECB/NoPadding"),
    AES_CBC_NoPadding("AES/CBC/NoPadding"),
    AES_CTR_NoPadding("AES/CTR/NoPadding"),
    AES_CFB_NoPadding("AES/CFB/NoPadding"),
    AES_OFB_NoPadding("AES/OFB/NoPadding"),
    AES_ECB_PKCS5Padding("AES/ECB/PKCS5Padding"),
    AES_CBC_PKCS5Padding("AES/CBC/PKCS5Padding"),
    AES_CTR_PKCS5Padding("AES/CTR/PKCS5Padding"),
    AES_CFB_PKCS5Padding("AES/CFB/PKCS5Padding"),
    AES_OFB_PKCS5Padding("AES/OFB/PKCS5Padding"),

    // DES 加密
    DES_ECB_NoPadding("DES/ECB/NoPadding"),
    DES_CBC_NoPadding("DES/CBC/NoPadding"),
    DES_CTR_NoPadding("DES/CTR/NoPadding"),
    DES_CFB_NoPadding("DES/CFB/NoPadding"),
    DES_OFB_NoPadding("DES/OFB/NoPadding"),
    DES_ECB_PKCS5Padding("DES/ECB/PKCS5Padding"),
    DES_CBC_PKCS5Padding("DES/CBC/PKCS5Padding"),
    DES_CTR_PKCS5Padding("DES/CTR/PKCS5Padding"),
    DES_CFB_PKCS5Padding("DES/CFB/PKCS5Padding"),
    DES_OFB_PKCS5Padding("DES/OFB/PKCS5Padding");

    private String algorithm;

    Algorithm(String algorithm) {
        this.algorithm = algorithm;
    }

}
